#include "headfiles.h"

using namespace std;

int main(int argc, char **argv) {
    if (argc != 2) {
        cout << "Usage: " << argv[0] << " file" << endl;
        return 0;
    }

    fstream fs;
    fs.open(argv[1], iostream::in);
    if (!fs.is_open()) {
        cout << "File " << argv[1] << " open error!" << endl;
        return 1;
    }

    string str;
    vector<int> vec;
    while (fs >> str) {
        if (str.empty()) {
            break;
        }

        int val = atoi(str.c_str());
        vec.push_back(val);
    }
    fs.close();

    vector<vector<int>> subset = subsets(vec);

    for (auto it = subset.begin(); it != subset.end(); it++) {
        if (it->empty()) {
            cout << "Empty subset" << endl;
        }

        for (auto sit = it->begin(); sit != it->end(); sit++) {
            cout << *sit << "\t";
        }
        cout << endl;
    }
    cout << endl;

    return 0;
}

